<?php
//==============================================
// 代码所有       PHPText.Net
// 代码作者       黄创钦,tine2cx@163.com
// 联系方式       QQ 233944397
// 本代码开源使用，可以随意修改传播，但请保留本版权
// 声明,谢谢合作！
//==============================================


	define("_NavLV_","GetPasswd");  //定义当前页面下拉菜单等级
	include "_Global.php";

	//是否为获取密码
	if($_POST["GetIssues"])
	{

		if(empty($_POST["FName"]))
		{
			ShowMegBox("昵称不能为空",$_SERVER["HTTP_REFERER"],'back');
		}

		if(!CheckMemberFName($_POST["FName"]))
		{
			ShowMegBox("昵称不存在",$_SERVER["HTTP_REFERER"],'back');
		}

		$GetPasswdFName  = $_POST["FName"];

		$MembersInfo     = TextDB_SearchData("Members","昵称",$_POST["FName"]);
		$GetPasswdIssues = $MembersInfo[0]["问题"];

		//显示问题回答
		$GetPasswdInputStep2 = "show";

	}
	elseif($_POST["GetPasswd"])
	{
		$GetPasswdFName  = "";
		$GetPasswdIssues = "";

		if(empty($_POST["FName"]))
		{
			ShowMegBox("昵称不能为空",$_SERVER["HTTP_REFERER"],'back');
		}

		if(!CheckMemberFName($_POST["FName"]))
		{
			ShowMegBox("昵称不存在",$_SERVER["HTTP_REFERER"],'back');
		}

		$MembersInfo = TextDB_SearchData("Members","昵称",$_POST["FName"]);
		if($MembersInfo[0]["答案"]==md5($_POST["Answer"]))
		{
			$NewPasswd = substr(GetSID(),0,6);
			TextDB_ChangeData("Members","昵称",$_POST["FName"],"密码",md5($NewPasswd));
		}
		else
		{
			ShowMegBox("答案不正确",$_SERVER["HTTP_REFERER"],'back');
		}

		$GetPasswdResult = "show";
	}
	else
	{
		$GetPasswdFName     = "";
		$GetPasswdIssues    = "";
		$NewPasswd          = "";
		$GetPasswdInputStep ="show";

	}

	_Header(_ForumTitle_);
	require GetMod('GetPasswd');
	_Footer();
?>